<!DOCTYPE html>
<script>
if (window.testRunner)
  testRunner.waitUntilDone();

function waitForVideoPresentation(video) {
  return new Promise(resolve => {
    video.requestVideoFrameCallback(resolve);
  });
}
function loadAndQueueVideoPresentation(video) {
  video.src = '../content/test.ogv';
  videoPresentations.push(waitForVideoPresentation(video));
}
let videoPresentations = [];

function addTrackWithRtlCueData(video, cueData) {
  var track = video.addTextTrack('subtitles');
  var cue = new VTTCue(0, 10, '\u05d0\u05d1\u05d2');
  for (var prop in cueData)
    cue[prop] = cueData[prop];
  track.addCue(cue);
  track.mode = 'showing';
}
</script>
<style>
video::cue {
  font-size: 50px;
  color: green;
  background-color: green;
}
</style>
<video preload="auto">
  <script>
  var video = document.currentScript.parentNode;
  addTrackWithRtlCueData(video, { align: 'start', size: 50, line: 0 });
  loadAndQueueVideoPresentation(video);
  </script>
</video>
<video preload="auto">
  <script>
  var video = document.currentScript.parentNode;
  addTrackWithRtlCueData(video, { align: 'center', size: 50, line: 0 });
  loadAndQueueVideoPresentation(video);
  </script>
</video>
<video preload="auto">
  <script>
  var video = document.currentScript.parentNode;
  addTrackWithRtlCueData(video, { align: 'end', size: 50, line: 0 });
  loadAndQueueVideoPresentation(video);
  </script>
</video>
<script>
  Promise.all(videoPresentations).then(() => {
    testRunner.notifyDone();
  });
</script>
